<template>
  <my-ref
      v-if="table"
      url="/dev/data-model-tree/list"
      v-model="$model"
      @loaded="procData"
      :multi="multi"
      :page-size="10"
      ref="list"
      name="模型树"
      :store="true"
      v-bind="[$attrs]"
      @change="v=>$emit('change',v)"
      :readOnly="readOnly"
  >
    <el-table-column label="name" align="center">
      <template v-slot="scope">
        {{ scope.row.name }}
      </template>
    </el-table-column>
    <el-table-column align="center" label="remark" prop="remark"></el-table-column>
    <el-table-column align="center" label="parent" prop="parent.name"></el-table-column>
    <template #query="scope">
    </template>
    <template #button>
      <el-button>选择模型树</el-button>
    </template>
  </my-ref>
</template>

<script setup>
/**
 * Created by CodeGenerator at 2024-04-15 22:17:49
 */



defineOptions({
  name: "ref-data-model-tree",
  inheritAttrs: true,
});

const $emit = defineEmits(["update:modelValue","proc","change"])
//定义 vue2的this,当前组件
const $self = getCurrentInstance();

//定义 $attrs
const $attrs = useAttrs();

//定义data
const $data = reactive({
});

const $props = defineProps({
  readOnly: {type: Boolean, default: false},
  multi: {type: Boolean, default: false}, //多选
})
const $model = defineModel({ type: [Object,Array] });
const list = ref();

const procData = (res, op) => {
  let json = res.data.data;
  json.forEach(it => {
    //如果是组合实体，设置 it.id=...
  });
}
</script>

<style scoped lang="scss">
</style>